Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
@contentful/rich-text-types
Advanced tools
Type definitions and constants for the Contentful rich text field type.
@contentful/rich-text-types is a TypeScript library that provides type definitions for the Contentful Rich Text field type. It allows developers to work with Contentful's rich text data in a type-safe manner, ensuring that the data structures are correctly handled and manipulated.
Type Definitions for Rich Text Nodes
This feature provides type definitions for different types of rich text nodes, such as blocks, inlines, and marks. The code sample demonstrates how to define a paragraph block with bold text.
import { BLOCKS, INLINES, MARKS } from '@contentful/rich-text-types';
const node = {
nodeType: BLOCKS.PARAGRAPH,
content: [
{
nodeType: 'text',
value: 'Hello, world!',
marks: [{ type: MARKS.BOLD }],
data: {}
}
],
data: {}
};
Type Definitions for Rich Text Document
This feature provides type definitions for the entire rich text document structure. The code sample shows how to define a simple document with a single paragraph.
import { Document } from '@contentful/rich-text-types';
const document: Document = {
nodeType: 'document',
data: {},
content: [
{
nodeType: 'paragraph',
content: [
{
nodeType: 'text',
value: 'This is a paragraph.',
marks: [],
data: {}
}
],
data: {}
}
]
};
Type Definitions for Rich Text Marks
This feature provides type definitions for text marks such as bold and italic. The code sample demonstrates how to use these type definitions.
import { MARKS } from '@contentful/rich-text-types';
const boldMark = MARKS.BOLD;
const italicMark = MARKS.ITALIC;
Draft.js is a JavaScript rich text editor framework, built for React. It provides a set of immutable models and helper functions for working with rich text content. Unlike @contentful/rich-text-types, which focuses on type definitions, Draft.js offers a full-fledged editor with extensive customization options.
Slate is a completely customizable framework for building rich text editors. It provides a set of tools and plugins to create complex editors with various features. Slate is more focused on the editor experience, whereas @contentful/rich-text-types is focused on type safety for Contentful's rich text data.
ProseMirror is a toolkit for building rich text editors with a focus on performance and flexibility. It provides a set of core modules and plugins to create highly customizable editors. ProseMirror is similar to Slate in its focus on the editor experience, while @contentful/rich-text-types is more about type definitions for Contentful's rich text.
Type definitions and constants for the Contentful rich text field type.
Block constants partially taken from markup-it.
FAQs
Type definitions and constants for the Contentful rich text field type.
The npm package @contentful/rich-text-types receives a total of 612,736 weekly downloads. As such, @contentful/rich-text-types popularity was classified as popular.
We found that @contentful/rich-text-types demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.